# -*- coding: utf-8 -*-
"""
Created on Wed Apr 10 16:38:31 2019

@author: LENOVO
"""
fruit = ['pineapple','pear']
fruit.insert(1,'grape')
print(fruit)

fruit[0:0] = ['Orange']
print(fruit)

fruit.remove('grape')
print(fruit)

fruit[0] = 'Grapefruit'
print(fruit)

del fruit[0:2]
print(fruit)

periodic_table = ['H','He','Li','Be','B','C','N','O','F','Ne']
print(periodic_table[0])
print(periodic_table[-2])
print(periodic_table[0:3])
print(periodic_table[-10:-7])
print(periodic_table[-10:])
print(periodic_table[:9])

NASDAQ_code = {'BIDU':'Baidu','SINA':'Sina'}
NASDAQ_code['YOKU'] = 'Youku'
print(NASDAQ_code)

NASDAQ_code.update({'FB':'Facebook','TSLA':'Tesla'})
print(NASDAQ_code)
del NASDAQ_code['FB']
print(NASDAQ_code)

letters = ('a','b','c','d','e','f','g')
print(letters[0])

a_set = {1,2,3,4}
a_set.add(5)
print(a_set)
a_set.discard(5)
print(a_set)

num_list = [6,2,7,4,1,3,5]
print(sorted(num_list))

print(sorted(num_list, reverse = True))

a = []
for i in range(1,11):
    a.append(i)
print(a)

b = [i for i in range(1,11)]
print(b)

import time
a = []
t0 = time.clock()
for i in range(1,20000):
    a.append(i)
print(time.clock() - t0, "seconds process time")

t0 = time.clock()
b = [i for i in range(1,20000)]
print(time.clock() - t0, "seconds process time")




